<template>
    <div id="theMessageList">
        <div id="theMessageList1">
            <h2>消息</h2>
            <button style="width:70px;height:40px;background-color: rgba(193, 171, 150);border: none;margin-top: 15px;margin-left: 220px;" @click="sT">设置</button>
        </div>
        <div id="theMessageList2">
            <div style="margin: 5px;padding: 5px;">
                <van-grid :column-num="3" center>
                <van-grid-item icon="logistics" text="物流消息" to="/logisticsInformation"/>
                <van-grid-item icon="volume-o" text="通知消息" to="/notificationMessage"/>
                <van-grid-item icon="comment-circle-o" text="互动消息" to="/interactiveMessage"/>
                </van-grid>
            </div>
        </div>
        <div id="theMessageList3">
            <div id="theMessageList3_1" v-for="item in xingXiData" :key="item.id" @click="dj(item)">
                <div style="width:20%;line-height: 90px;text-align: center;">
                    <img :src="item.img" alt="" style="width:60px;height:60px;border-radius: 45px;box-shadow:0 0 10px #333;margin-top: 15px;">
                </div>
                <div style="width:80%;">
                    <div style="height:50%;width:100%;line-height:45px;">
                        <span style="float:left;font-weight: bolder;font-size: 16px;">
                            {{item.name}}
                        </span>
                        <span style="float: right;font-weight: 100;">
                            {{item.shijiang}}
                        </span>
                    </div>
                    <div style="height:50%;width:100%;line-height:45px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
                        <span style="float:left;font-weight: 100;width: 90%;">
                            {{item.xingxi}}
                        </span>
                        <div style="width:10%;float: right;">
                            <van-badge :content="20"/>
                        </div>
                    </div>
                </div>
                <!-- <router-link :to="{path:'/chatScreen',params:{data:xingXiData}}">jjjj</router-link> -->
            </div>
        </div>
        <div>
            <van-tabbar v-model="active">
            <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
            <van-tabbar-item icon="search" to="/productCate">分类</van-tabbar-item>
            <van-tabbar-item icon="chat-o">消息</van-tabbar-item>
            <van-tabbar-item icon="cart-o" to="/shoppingCart">购物车</van-tabbar-item>
            <van-tabbar-item icon="setting-o" to="/mypage">我的</van-tabbar-item>
            </van-tabbar>
        </div>
    </div>
</template>
<script setup lang="ts">
    import {ref,onMounted} from 'vue'
    import { useRouter,useRoute } from "vue-router";
    import {getXingXi} from '@/api/text'
    let active = ref(2);
    const router = useRouter()
    onMounted(() => {
        getXingXi().then(res=>{
            xingXiData.value = res.data.data
        })
    })
    let xingXiData:any = ref([])
    let dj = (data:any)=>{
        router.push({path:'/chatScreen',query:{data:JSON.stringify(data)}})  
    }
    let sT = ()=>{
        router.push({path:'/setUp',query:{id:2}})
    }
</script>
<style scoped>
    #theMessageList {
        width:100%;
        height: 850px;
        margin: 0px;
    }
    #theMessageList1 {
        height:15%;
        width:100%;
        color: white;
        background-color: rgba(193, 171, 150);
        padding-top: 50px;
        padding-left: 20px;
        display: flex;
    }
    #theMessageList2 {
        /* position: fixed; */
        position: absolute;
        width: 90%;
        height: 100px;
        border-radius: 20px;
        left: 0;
        right: 0;
        top:130px;
        margin: auto;
        box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.35);
        -webkit-box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.35);
        -moz-box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.35);
        background-color: rgba(255, 255, 255);
        /* padding: 20px; */
    }
    #theMessageList3 {
        margin-top: 100px;
    }
    #theMessageList3_1 {
        width: 100%;
        height: 90px;
        border-bottom: 1px solid #f2f2f2;
        display: flex;
    }
</style>